1. Field of the Invention
The present invention relates to performance enhancements in object-oriented programming systems. More specifically, the present invention relates to a method and an apparatus that supports finer marking granularity for fields within objects defined within an object-oriented programming system.
2. Related Art
As increasing semiconductor integration densities allow more transistors to be integrated onto a microprocessor chip, computer designers are investigating different methods of using these transistors to increase computer system performance Some recent computer architectures exploit xe2x80x9cinstruction level parallelism,xe2x80x9d in which a single central processing unit (CPU) issues multiple instructions in a single cycle. Given proper compiler support, instruction level parallelism has proven effective at increasing computational performance across a wide range of computational tasks. However, inter-instruction dependencies generally limit the performance gains realized from using instruction level parallelism to a factor of two or three.
Another method for increasing computational speed is xe2x80x9cspeculative executionxe2x80x9d in which a processor executes multiple branch paths simultaneously, or predicts a branch, so that the processor can continue executing without waiting for the result of the branch operation. By reducing dependencies on branch conditions, speculative execution can increase the total number of instructions issued.
Unfortunately, conventional speculative execution typically provides a limited performance improvement because only a small number of instructions can be speculatively executed. One reason for this limitation is that conventional speculative execution is typically performed at the basic block level, and basic blocks tend to include only a small number of instructions. Another reason is that conventional hardware structures used to perform speculative execution can only accommodate a small number of speculative instructions.
What is needed is a method and apparatus that facilitates speculative execution of program instructions at a higher level of granularity so that many more instruct ions can be speculatively executed.
One challenge in designing a system that supports speculative execution is to detect a rollback condition. A rollback condition can occur in a number of situations. For example, a rollback condition occurs when a speculative thread that is executing program instructions in advance of a head thread reads from a memory element before the head thread performs a write to the memory element. In this case, the speculative thread must xe2x80x9crollbackxe2x80x9d so that it can read the value stored by the head thread. A rollback condition can be detected by xe2x80x9cmarkingxe2x80x9d memory elements as they are read by the speculative thread so that the head thread can subsequently determine if the memory elements have been read by the speculative thread. Unfortunately, using a separate marking indicator for each memory element can consume a large amount of memory, which can reduce cache hit rates arid thereby degrade system performance.
What is needed is a method and an apparatus for marking memory elements that does require a large amount of memory for storing marking indicators.
One embodiment of the present invention provides a system that facilitates marking of objects defined within an object-oriented programming system to keep track of accesses to fields within the objects. The system operates by receiving a reference to a field within an object, and identifying a marking bit within the object that is associated with the field. Note that each marking bit within the object is associated with a different subset of fields within the object. Next, the system sets the marking bit to indicate that at least one field within the associated subset of fields has been referenced. Finally, the system performs the reference to the field.
In one embodiment of the present invention, the object includes N marking bits numbered 0, 1, 2, . . . , Nxe2x88x921 and M fields numbered 0, 1, 2, . . . , Mxe2x88x921. In this embodiment, the system identifies the marking bit associated with the field by starting with a field number for the field, and applying a modulo N operation to the field number to produce a number for the associated marking bit. In a variation on this embodiment, N is a power of two.
In one embodiment of the present invention, the system supports space and time dimensional execution. To this end, the system supports a head thread that executes program instructions and a speculative thread that executes program instructions in advance of the head thread. The head thread accesses a primary version of the object and the speculative thread accesses a space-time dimensioned version of the object. In this embodiment, the steps of identifying the marking bit and setting the marking bit take place for a read operation by the speculative thread.
In a variation on this embodiment, there exists a separate set of marking bits for write operations. In this variation, if the reference is a write operation by the speculative thread, the steps of identifying the marking bit and setting the marking bit involve the separate set of marking bits. Upon a subsequent write operation to the field by the head thread, the head thread writes to both the primary version and the space-time dimensioned version if the marking bit is unset, and otherwise writes to the primary version.
In one embodiment of the present invention, during a subsequent write, operation to the field by the head thread, the system determines if the marking bit associated with the field has been set by executing a special bit extract instruction to examine the marking bit.
In one embodiment of the present invention, if the object is an array object with N marking bits numbered 0, 1, 2, . . . , Nxe2x88x921 and M array elements numbered 0, 1, 2, . . . , Mxe2x88x921, the step of identifying the marking bit that is associated with the field includes identifying an array index for an array element, and dividing the array index by the ceiling of M/N to produce a number for the associated marking bit. In a variation on this embodiment, the ceiling of M/N is a power of two. Hence, the division operation can be accomplished by shifting the array index so that the moss significant bits of the array index become the number for the associated marking bit.
In one embodiment of the present invention, if the reference involves a block transfer operation, the system determines if the block transfer operation touches array elements associated with multiple marking bits, and if so sets the multiple marking bits.
In one embodiment of the present invention, the system resets marking bits within the object after a subsequent join operation or rollback operation. In a variation on this embodiment, this resetting occurs during a subsequent setting of a marking bit after the subsequent join operation or rollback operation.
In one embodiment of the present invention, all marking bits within the object are contained in a single word of memory that additionally contains a time stamp.